package com.wanandroidsdk;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.wanandroidsdk.bean.DataBean;
import com.wanandroidsdk.http.WanAndroidHttpUtil;
import com.wanandroidsdk.http.WanHttpCallBack;
import com.wanandroidsdk.util.LogUtils;

import java.util.List;


public class MainActivity  extends AppCompatActivity {
    private static final String TAG = MainActivity.class.getName();
    private TextView textView;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        initData();
    }

    private void initView() {
        textView = findViewById(R.id.tv_test);
    }

    private void initData() {
        WanAndroidHttpUtil.getKnwLedge(new WanHttpCallBack() {
            @Override
            public Boolean onResponse(List<DataBean> result) {
                textView.setText(result.get(0).getName());
                LogUtils.d(TAG,"===请求成功数据为==="+result.get(0).getName());
                return null;
            }

            @Override
            public Boolean onFailure(String message) {
                return null;
            }
        });
    }
}
